<!DOCTYPE html>
<!-- saved from url=(0052)http://getbootstrap.com/docs/4.0/examples/dashboard/ -->
<html lang="zh_CN" xmlns:th="https://www.thymeleaf.org">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
		<meta name="description" content="">
		<meta name="author" content="">

		<title>后台管理</title>
		<!-- Bootstrap core CSS -->
		<link href="/static/css/bootstrap.min.css" rel="stylesheet">
		<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-LY6QZQpYtqgQLJeUeh2disXkUUa+fRYfq/3dxdpkU5PQZUCqg/BK4wrhQ9idOojx" crossorigin="anonymous">
		<link href="/static/layui/css/layui.css" rel="stylesheet">
		<script src="/static/layui/layui.js"></script>
		<!-- Custom styles for this template -->
		<link href="/static/css/dashboard.css" rel="stylesheet">
		<link rel="stylesheet" href="/static/build/layui.css" media="all">
		<style>
			th{
				width: 125px;
			}

		</style>
		<link href="/static/layui/css/layui.css" rel="stylesheet">

		<style type="text/css">
			/* Chart.js */
			
			@-webkit-keyframes chartjs-render-animation {
				from {
					opacity: 0.99
				}
				to {
					opacity: 1
				}
			}
			
			@keyframes chartjs-render-animation {
				from {
					opacity: 0.99
				}
				to {
					opacity: 1
				}
			}
			
			.chartjs-render-monitor {
				-webkit-animation: chartjs-render-animation 0.001s;
				animation: chartjs-render-animation 0.001s;
			}
		</style>
		<link href="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.css" rel="stylesheet">
		<script src="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.js"></script>
		<script>

			/* 批量删除 */
			function datadel(){
				//获取选中的id
				var ids = new Array();
				// $('input[name="id"]:checked').each(function(idx,element){
				// 	console.log($(element).text())
				// 	ids.push($(element).text());
				// });
				function f() {
					location.reload();
				}

				$('input[name="id"]:checked').each(function(index, element) {
					//追加到数组中
					ids.push($(this).val());
				});

				var obj = {"ids":ids};
				console.log(obj)
					if (window.confirm("您确认要删除选中的内容吗？")){
						$.ajax({
							type: "POST",
							url: "/user/pageDelete",
							data:$.param(obj,true), // 数组序列化
							dataType:"json",
							success: function(data){
								console.log(data)
								location.reload();
							}
						});
						return true;
					}

			}

		</script>

	</head>


	<body>

	<div th:replace="~{comm/comm :: top}"></div>

	<div class="container-fluid">
		<div class="row">
			<div th:replace="~{comm/comm::sid(active='customerlist')}"></div>
			<main role="main" class="col-md-9 ml-sm-auto col-lg-10 pt-3 px-4">
				<div style="text-align: center">
					<img style="width: 10%;height: 10%;" th:src="@{/static/img/left.png}">
					<span style="font-weight:bold;font-size: 50px">客户列表</span>
					<img style="width: 10%;height: 10%;" th:src="@{/static/img/right.png}">
				</div>
				<h2>
					<button type="submit" id="del" onclick="datadel()"	class="btn btn-danger">批量删除</button>
				</h2>
				<br>

				<div class="table-responsive">
					<form>

					<table class="table table-striped table-sm">
						<thead style="text-align: center">
						<tr >
							<th style="width: 40px;margin-left:20px;">选择</th>
							<th>客户姓名</th>
							<th>邮箱</th>
							<th>手机号</th>
							<th>客户留言</th>
							<th>提交时间</th>
							<th>操作</th>
						</tr>
						</thead>
						<tbody>
						<tr  style="text-align: center;"th:each="customer:${customers}">
							<td style="text-align: center;vertical-align: middle;" id="ad">
								<input name="id"  type="checkbox" th:value="${customer.getId()}">
							</td>
							<td  style="vertical-align: middle;" th:text="${customer.getCont()}"></td>
							<td  style="vertical-align: middle;" th:text="${customer.getEmail()}"></td>
							<td  style="vertical-align: middle;" th:text="${customer.getPhone()}"></td>
							<td  style="vertical-align: middle;" th:text="${customer.getComments()}"></td>
							<td  style="vertical-align: middle;" th:text="${#calendars.format(customer.getTimes(),'YYYY-MM-dd HH:mm:ss')}"></td>
							<td style="color:white;vertical-align: middle;" >
								<a class="btn btn-danger" th:href="@{/user/deleteCustomer(id=${customer.getId()})}">删除</a>
							</td>
						</tr>
						</tbody>
					</table>
					</form >
					<div style="text-align: center;color: #FFFFFF">
						<a class="layui-btn layui-btn-radius" th:href="@{/user/page(page=1)}">首页</a>
						<a th:class="${ pageStart ==1 ?'layui-btn layui-btn-radius layui-btn-disabled':'layui-btn layui-btn-radius'}" th:style="${pageStart == 1?'pointer-events: none;':''}" th:href="@{/user/page(page=${pageStart}-1)}">上一页</a>
						<a th:class="${ pageStart == pageSize ?'layui-btn layui-btn-radius layui-btn-disabled':'layui-btn layui-btn-radius'}" th:style="${pageStart == pageSize?'pointer-events: none;':''}" th:href="@{/user/page(page=${pageStart}+1)}">下一页</a>
						<a class="layui-btn layui-btn-radius" th:href="@{/user/page(page=${pageSize})}">尾页</a>
					</div>
				</div>
			</main>
		</div>
	</div>


	<!-- Bootstrap core JavaScript
================================================== -->
		<!-- Placed at the end of the document so the pages load faster -->
		<script src="/static/js/jquery-3.6.0.js" type="text/javascript"></script>
		<script type="text/javascript" src="/static/js/popper.min.js" ></script>
		<script type="text/javascript" src="/static/js/bootstrap.min.js" ></script>

		<!-- Icons -->
		<script type="text/javascript" src="/static/js/feather.min.js" ></script>
		<script>
			feather.replace()
		</script>

		<!-- Graphs -->
		<script type="text/javascript" src="/static/js/Chart.min.js" ></script>
		<script>
			var ctx = document.getElementById("myChart");
			var myChart = new Chart(ctx, {
				type: 'line',
				data: {
					labels: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
					datasets: [{
						data: [15339, 21345, 18483, 24003, 23489, 24092, 12034],
						lineTension: 0,
						backgroundColor: 'transparent',
						borderColor: '#007bff',
						borderWidth: 4,
						pointBackgroundColor: '#007bff'
					}]
				},
				options: {
					scales: {
						yAxes: [{
							ticks: {
								beginAtZero: false
							}
						}]
					},
					legend: {
						display: false,
					}
				}
			});
		</script>

	</body>

</html>